package coasttocoast.game;

/**
 * Abstract base class for all objects contained on a Board.
 *
 * @author gsh
 */
public abstract class Entity {
  private int id;

  public Entity(int id) {
    this.id = id;
  }

  /**
   * Returns the unique identifier for this entity.
   *
   * @return Unique identifier for this entity.
   */
  public int getId() {
    return id;
  }

  @Override
  public int hashCode() {
    return getId();
  }

  @Override
  public boolean equals(Object o) {
    return (o instanceof Entity) && (((Entity) o).getId() == getId());
  }
}
